﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace IPCPhotoEditor.ChildForms
{
    public partial class FormExportConfigFile : Form
    {
        private string _selectedPath = "";
        public string SelectedPath
        {
            get { return _selectedPath; }
        }
        public FormExportConfigFile()
        {
            InitializeComponent();
        }

        private void buttonBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog form = new FolderBrowserDialog();
            form.SelectedPath = "D:\\";
            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                textBoxFolder.Text = form.SelectedPath;
            }
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxFolder.Text))
            {
                MessageBox.Show("导出目录不能为空!");
                return;
            }
            _selectedPath = textBoxFolder.Text;
            if (!Directory.Exists(_selectedPath))
            {
                MessageBox.Show("导出目录不存在!");
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
    }
}
